<?php 
include('../Connections/KRAPPERCON.php');
include ("../Connections/Accesos.php");
$combo = '';
include ('../Query_Min/getAlmacenes.php');
?>
<table width="100%" border="0" cellspacing="0" id="tbl_chg_cos" cellpadding="0">
  <tr>
    <td>Almacen</td>
    <td>
      <select name="cb_cs_alm" id="cb_cs_alm" onChange="introCsCod()">
            <?php echo $combo;?>      
      </select>
    </td>
  </tr>
  <tr>
    <td>Codigo</td>
    <td>
    <input type="text" class="clsReq" name="t_cs_cod" id="t_cs_cod" onKeyPress="if(event.keyCode==13)introCsCod();">
    </td>
  </tr>
    <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td colspan="2">
    <div id="d_cs_tbl">    </div>    </td>
  </tr>
</table>
<script type="text/javascript">
function introCsCod(){
var	cod = GEBI('t_cs_cod').value;

if ($.trim(cod)=='') {
//showError('Ingresar Codigo');
return;
}

var alm = GEBI('cb_cs_alm').value;

$('#d_cs_tbl').loadx('Procesos/Opers/OperChgCos.php',{
	oper : 'view',
	almacen : alm,
	codigo : cod	
	}
	);
}

function saveCosThis(obj){
	
	if (!$("#tbl_chg_cos").checkInput()){
	return;
	}
	
	var fila = $(obj).parent().parent();
	var cod = fila.find('.clsCosCod').html();
	var alm = fila.find('.clsCosAlm').html();
	var cst = fila.find('.clsCosCos').val();
	
	sendData('Procesos/Opers/OperChgCos.php',{
	oper : 'save',
	indiv : 1,
	almacen : alm,
	codigo : cod,
	costo : cst	
	});

}

function saveNewCos(){
$('#d_cs_tbl tbody tr').each(function(){
	var fila = $(this);
	var cod = fila.find('.clsCosCod').html();
	var alm = fila.find('.clsCosAlm').html();
	var cst = fila.find('.clsCosCos').val();
	
	sendData('Procesos/Opers/OperChgCos.php',{
	oper : 'save',
	almacen : alm,
	codigo : cod,
	costo : cst	
	});
});
}
</script>

